package tema8.ej05.model;

import java.util.List;

import org.hibernate.Transaction;

import tema8.ej05.model.bo.Persona;

public class PersonaDAO extends DAObase {
	public void crearPersona(Persona persona) {
		Transaction tx = session.beginTransaction();
		session.persist(persona);
		tx.commit();
	}

	public List<Persona> recuperarPersonas() {
		Transaction t = session.beginTransaction();
		@SuppressWarnings("unchecked")
		List<Persona> listaPersonas = session.createQuery("from Persona").list();
		t.commit();
		return listaPersonas;
	}
}
